// 实时商品库存明细
const {DataTypes, db } = require("../db");
db.define('inventoryDetail', {
id: {type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true,comment:'表自增ID'},
tenantId:{type: DataTypes.INTEGER,allowNull:false,comment:'租户'}, 
locationId:{type: DataTypes.INTEGER,allowNull:false,comment:'仓库ID'}, 
invId:{type: DataTypes.INTEGER,allowNull:false,comment:'商品ID'}, 
seq:{type: DataTypes.INTEGER,defaultValue:0,comment:'排序'}, 
billNo:{type: DataTypes.STRING(30),comment:'关联票据号'}, 
relId:{type: DataTypes.INTEGER,comment:'关联ID'}, 
billDate:{type: DataTypes.STRING(10),comment:'票据日期'}, 
transTypeName:{type: DataTypes.STRING(50),allowNull:false,comment:'业务类型'}, 
transType:{type: DataTypes.INTEGER,comment:''}, 
inCount:{type: DataTypes.FLOAT,defaultValue:0,comment:'入库数量'}, 
inPrice:{type: DataTypes.FLOAT,defaultValue:0,comment:'入库单价'}, 
inMoney:{type: DataTypes.FLOAT,defaultValue:0,comment:'入库金额'}, 
outCount:{type: DataTypes.FLOAT,defaultValue:0,comment:'出库数量'}, 
costPrice:{type: DataTypes.FLOAT,defaultValue:0,comment:'成本单价'},
costMoney:{type: DataTypes.FLOAT,defaultValue:0,comment:'成本金额'}, 
lastCount:{type: DataTypes.FLOAT,allowNull:false,comment:'库存小单位'}, 
lastPrice:{type: DataTypes.FLOAT,allowNull:false,comment:'小单位成本'}, 
lastMoney:{type: DataTypes.FLOAT,allowNull:false,comment:'余额'}, 
unit:{type: DataTypes.STRING(20),comment:'单位'}, 
spec:{type: DataTypes.INTEGER,defaultValue:1,comment:'规格'}, 
calNum:{type: DataTypes.INTEGER,comment:'换算系数'}, 
unit1:{type: DataTypes.STRING(10),comment:'大单位'}, 
unit2:{type: DataTypes.STRING(10),comment:'小单位'}, 
iid:{type: DataTypes.INTEGER,comment:'票据主表ID'}, 
bak1:{type: DataTypes.STRING(255),comment:''}, 
bak2:{type: DataTypes.STRING(255),comment:''}, 
ctime:{type: DataTypes.STRING(20),comment:''}, 

}, {
    tableName: 'inventory_detail',
    timestamps: false,
    comment: '实时商品库存明细'
});